package com.ibangnuo.manage.controller.order;


import com.ibangnuo.api.order.OrderCountControllerApi;
import com.ibangnuo.framework.domain.request.count.MoneyCountRequest;
import com.ibangnuo.framework.model.response.QueryResponseResult;
import com.ibangnuo.manage.service.order.OrderCountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;

/**
 * @Author: wwy
 * @Date: 2019-12-31 13:57
 */
@RestController
@RequestMapping("/order")
@CrossOrigin
public class OrderCountController implements OrderCountControllerApi {
    @Autowired
    private OrderCountService orderCountService;

    @Override
    public QueryResponseResult findCount(MoneyCountRequest moneyCountRequest) {
        return null;
    }

    //登录者的日汇总
    @Override
    @PostMapping("/orderReports")
    public QueryResponseResult orderReports(@RequestBody MoneyCountRequest moneyCountRequest) {
        QueryResponseResult queryResponseResult = null;
        try {
            queryResponseResult = orderCountService.orderReports(moneyCountRequest);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return queryResponseResult;
    }

    //登录者的商户日汇总
    @Override
    @PostMapping("/orderReportsCommercial")
    public QueryResponseResult orderReportsCommercial(@RequestBody MoneyCountRequest moneyCountRequest) {
        QueryResponseResult queryResponseResult = null;
        try {
            queryResponseResult = orderCountService.orderReportsCommercial(moneyCountRequest);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return queryResponseResult;
    }

    //代理商下级代理的日汇总
    @Override
    @PostMapping("/orderReportsAgent")
    public QueryResponseResult orderReportsAgent(@RequestBody MoneyCountRequest moneyCountRequest) {

        QueryResponseResult queryResponseResult = null;
        try {
            queryResponseResult = orderCountService.orderReportsAgent(moneyCountRequest);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return queryResponseResult;

    }

    //月汇总
    @Override
    @PostMapping("/orderReportsMonth")
    public QueryResponseResult orderReportsMonth(@RequestBody MoneyCountRequest moneyCountRequest) {
        QueryResponseResult queryResponseResult = null;
        try {
            queryResponseResult = orderCountService.orderReportsMonth(moneyCountRequest);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return queryResponseResult;

    }

    //商户月交易报表
    @Override
    @PostMapping("/monthOrderReportsCommercial")
    public QueryResponseResult monthOrderReportsCommercial(@RequestBody MoneyCountRequest moneyCountRequest) {
        QueryResponseResult queryResponseResult = null;
        try {
            queryResponseResult = orderCountService.monthOrderReportsCommercial(moneyCountRequest);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return queryResponseResult;
    }

    //代理商下级代理的月汇总
    @Override
    @PostMapping("/monthOrderReportsAgent")
    public QueryResponseResult monthOrderReportsAgent(@RequestBody MoneyCountRequest moneyCountRequest) {
        QueryResponseResult queryResponseResult = null;
        try {
            queryResponseResult = orderCountService.monthOrderReportsAgent(moneyCountRequest);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return queryResponseResult;
    }


    //佣金明细小计
    @Override
    @GetMapping("/commissionDetailed")
    public QueryResponseResult commissionDetailed() {
        QueryResponseResult queryResponseResult = orderCountService.commissionDetailed();
        return queryResponseResult;
    }

    //佣金明细月表单
    @Override
    @PostMapping("/commissionDetailedMonth")
    public QueryResponseResult commissionDetailedMonth(@RequestBody MoneyCountRequest moneyCountRequest) {
        QueryResponseResult queryResponseResult = null;
        try {
            queryResponseResult = orderCountService.commissionDetailedMonth(moneyCountRequest);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return queryResponseResult;
    }

    //佣金明细日表单
    @Override
    @PostMapping("/commissionDetailedDate")
    public QueryResponseResult commissionDetailedDate(@RequestBody MoneyCountRequest moneyCountRequest) {
        QueryResponseResult queryResponseResult = null;
        try {
            queryResponseResult = orderCountService.commissionDetailedDate(moneyCountRequest);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return queryResponseResult;
    }
}
